diff options
| author | Adam Soltys <[email protected]> | 2024-11-08 17:06:38 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-08 17:06:38 -0800 |
| commit | 9fb49a6a61239ac30d6b85befc4f33a5f3469611 (patch) | |
| tree | cc5be8a4ed55f083d61dbc7e735bf748d3e88c25 /src/routes/(app)/[username] | |
| parent | 869dc52184ea1fb7e5b5174bdb07979e69f3006f (diff) | |
| download | coinos-ui-9fb49a6a61239ac30d6b85befc4f33a5f3469611.tar.gz coinos-ui-9fb49a6a61239ac30d6b85befc4f33a5f3469611.zip | |
fix tip dialog
Diffstat (limited to 'src/routes/(app)/[username]')
| -rw-r--r-- | src/routes/(app)/[username]/(profile)/+layout.svelte | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 65911eee..2be99adc 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -1,6 +1,4 @@ <script> - import { run, preventDefault } from 'svelte/legacy'; - import { invalidate } from "$app/navigation"; import { browser } from "$app/environment"; import { hexToUint8Array } from "uint8array-extras"; @@ -25,23 +23,8 @@ followers, followList, } = $state(data); - let { currency, npub, username: n, display } = $state(subject); - - let refresh = (data) => { - ({ - events, - user, - subject, - src, - rates, - text, - follows, - followers, - followList, - } = data); - ({ currency, npub, username: n, display } = subject); - }; + let { currency, npub, username: n, display } = $state(subject); let list = $state([]); let follow = async () => { @@ -89,7 +72,6 @@ } }; - let showBio = $state(); let toggleBio = () => (showBio = !showBio); @@ -98,7 +80,8 @@ let password = $state(); - let reset = async () => { + let reset = async (e) => { + e.preventDefault(); try { await post(`/reset`, { username: n, password }); success("Password reset"); @@ -106,18 +89,16 @@ fail(e.message); } }; - run(() => { - refresh(data); - }); + let stripped = $derived(n.replace(/\s/g, "")); let username = $derived(n.length > 60 ? n.substr(0, 6) : display || stripped); - let lnaddr = $derived(subject?.anon - ? subject.lud16 || undefined - : `${stripped}@${$page.url.host}`); + let lnaddr = $derived( + subject?.anon + ? subject.lud16 || undefined + : `${stripped}@${$page.url.host}`, + ); let profile = $derived(`${$page.url.host}/${subject.anon ? npub : stripped}`); - run(() => { - followList.then((l) => (list = l)); - }); + $effect(() => followList.then((l) => (list = l))); let following = $derived(list.some((t) => t.includes(subject.pubkey))); </script> @@ -184,10 +165,12 @@ </div> <div class="flex mb-auto gap-1"> <button class="my-auto" onclick={() => copy(lnaddr)} - ><iconify-icon icon="ph:copy-bold" width="32"></iconify-icon></button + ><iconify-icon icon="ph:copy-bold" width="32" + ></iconify-icon></button > <a href={`/qr/${encodeURIComponent(lnaddr)}`} class="my-auto"> - <iconify-icon icon="ph:qr-code-bold" width="32"></iconify-icon> + <iconify-icon icon="ph:qr-code-bold" width="32" + ></iconify-icon> </a> </div> </div> @@ -201,7 +184,8 @@ </div> <div class="flex mb-auto gap-1"> <button class="my-auto" onclick={() => copy(profile)} - ><iconify-icon icon="ph:copy-bold" width="32"></iconify-icon></button + ><iconify-icon icon="ph:copy-bold" width="32" + ></iconify-icon></button > <a href={`/qr/${encodeURIComponent( @@ -222,7 +206,8 @@ </div> <div class="flex my-auto gap-1"> <button class="my-auto" onclick={() => copy(npub)} - ><iconify-icon icon="ph:copy-bold" width="32"></iconify-icon></button + ><iconify-icon icon="ph:copy-bold" width="32" + ></iconify-icon></button > <a href={`/qr/${encodeURIComponent(npub)}`} class="my-auto"> <iconify-icon icon="ph:qr-code-bold" width="32"></iconify-icon> @@ -262,7 +247,7 @@ <!-- {/if} --> {#if user?.admin && user.username !== subject.username} - <form class="w-full flex" onsubmit={preventDefault(reset)}> + <form class="w-full flex" onsubmit={reset}> <input placeholder="Password reset" bind:value={password} /> <button type="submit" |
